pkg_name=cross-gmp
version=6.0.0a
src_version=6.0.0
build_dir=$builds_dir_root/$pkg_name-$version
src_dir=$src_dir_root/gmp-$src_version
url=https://gmplib.org/download/gmp/gmp-$version.tar.xz

rm -Rf "$src_dir"
cd "$src_dir_root"
tar Jxf "gmp-$version.tar.xz"

rm -Rf "$build_dir"
mkdir -p "$build_dir"
cd "$build_dir"

export CFLAGS=-O0
"$src_dir/configure"			\
	"--prefix=$cross_dir_root"	\
	--disable-static		\
	--with-gnu-ld
unset CFLAGS

make

install_tmp_dir=/tmp/$pkg_name-$version
rm -Rf "$install_tmp_dir"
mkdir -p "$install_tmp_dir"
make install "DESTDIR=$install_tmp_dir"

install_dirs_with_prefix "$builders_dir_root/$pkg_name/runtime.dirs" "$cross_dir_root/"
install_files_with_prefix "$builders_dir_root/$pkg_name/runtime.files" "$install_tmp_dir" "$cross_dir_root/"
install_links_with_prefix "$builders_dir_root/$pkg_name/runtime.links" "$cross_dir_root/"
install_dirs_with_prefix  "$builders_dir_root/$pkg_name/devel.dirs" "$cross_dir_root/"
install_files_with_prefix "$builders_dir_root/$pkg_name/devel.files" "$install_tmp_dir" "$cross_dir_root/"
install_links_with_prefix "$builders_dir_root/$pkg_name/devel.links" "$cross_dir_root/"
elf_strip_with_prefix "$builders_dir_root/$pkg_name/elf-strip" "$cross_dir_root/"

rm -Rf "$install_tmp_dir"
rm -Rf "$build_dir"
rm -Rf "$src_dir"
